#set ,不支持随机访问

def Set():

    s1 = set()
    print(type(s1))

    school ={'xm','xq','xh'}
    school.add('xl')
    print(school)

    school ={'xm','xq','xh'}
    c =school.copy()
    print(id(c))
    print(id(school))

    x ={'dd','bb','aa'}
    y ={'gg','bb','nn'}
    z= x.difference(y)
    print(f'差集{z}')

    x = {'dd', 'bb', 'aa'}
    y = {'gg', 'bb', 'nn'}
    x.difference_update(y)
    print(x)
    print('#' * 50)

    school.discard('xm')
    print(school)
    print('-' * 50)

    x = {"a", "b", "c"}
    y = {"c", "d", "e"}
    z = {"f", "g", "c"}
    result = x.intersection(y, z)
    print(result)
    print('-' * 50)

    x = {'dd', 'bb', 'aa'}
    y = {'gg', 'bb', 'nn'}
    z = x.symmetric_difference(y)
    print(z)
    print('#' * 50)

    x = {'dd', 'bb', 'aa'}
    y = {'gg', 'bb', 'nn'}
    z = x.union(y)
    print(z)

    print('dd' in z)

    print(x - y)
    print(x | y)
    print(x & y)
    print(x ^ y)


def Generator():

    tuple1 = tuple(x for x in range(10))  # 元祖生成式
    print(tuple1)
    set1={x for x in 'afsafasadfsada' if x not in 'afs'}
    print(set1)
    print(len(set1))


if __name__ == '__main__':
    Set()
    Generator()